/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
 var twoSum = function(nums=
    [2,7,11,15], target=9) {
    let tem = {}
    // debugger
    for(let i=0;i<nums.length;i++){

        const wantKey=target-parseInt(nums[i])+''
        if(Object.keys(tem).indexOf(wantKey)!==-1){
            return[i,tem[wantKey]]
        }else{
            tem[nums[i]]=i
        }
    }
};
